package core.ui.demo;

import javafx.scene.chart.AreaChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
/**
 * @author 李瑜
 * @since JavaFX 8.0
 */
public class DemoAreaChart
{
	@SuppressWarnings("unchecked")
	public static AreaChart<Number, Number> getAreaChart()
	{
		NumberAxis xAxis = new NumberAxis(1, 31, 1);
		NumberAxis yAxis = new NumberAxis(300,350,10);
		AreaChart<Number, Number> areaChart = new AreaChart<>(xAxis, yAxis);

		areaChart.setTitle("11级Java出勤人数");

		XYChart.Series<Number, Number> seriesApril = new XYChart.Series<Number, Number>();
		seriesApril.setName("3月");
		seriesApril.getData().add(new XYChart.Data<Number, Number>(1, 304));
		seriesApril.getData().add(new XYChart.Data<Number, Number>(3, 310));
		seriesApril.getData().add(new XYChart.Data<Number, Number>(6, 315));
		seriesApril.getData().add(new XYChart.Data<Number, Number>(9, 308));
		seriesApril.getData().add(new XYChart.Data<Number, Number>(12, 305));
		seriesApril.getData().add(new XYChart.Data<Number, Number>(15, 318));
		seriesApril.getData().add(new XYChart.Data<Number, Number>(18, 315));
		seriesApril.getData().add(new XYChart.Data<Number, Number>(21, 313));
		seriesApril.getData().add(new XYChart.Data<Number, Number>(24, 319));
		seriesApril.getData().add(new XYChart.Data<Number, Number>(27, 321));
		seriesApril.getData().add(new XYChart.Data<Number, Number>(30, 321));

		XYChart.Series<Number, Number> seriesMay = new XYChart.Series<Number, Number>();
		seriesMay.setName("5月");
		seriesMay.getData().add(new XYChart.Data<Number, Number>(1, 320));
		seriesMay.getData().add(new XYChart.Data<Number, Number>(3, 315));
		seriesMay.getData().add(new XYChart.Data<Number, Number>(6, 313));
		seriesMay.getData().add(new XYChart.Data<Number, Number>(9, 312));
		seriesMay.getData().add(new XYChart.Data<Number, Number>(12, 314));
		seriesMay.getData().add(new XYChart.Data<Number, Number>(15, 318));
		seriesMay.getData().add(new XYChart.Data<Number, Number>(18, 325));
		seriesMay.getData().add(new XYChart.Data<Number, Number>(21, 325));
		seriesMay.getData().add(new XYChart.Data<Number, Number>(24, 323));
		seriesMay.getData().add(new XYChart.Data<Number, Number>(27, 326));
		seriesMay.getData().add(new XYChart.Data<Number, Number>(31, 326));

		areaChart.getData().addAll(seriesApril, seriesMay);
		return areaChart;
	}

}
